package com.gzhryc.net_marketing.cloud.account.callback;

import com.gzhryc.common.StringTools;
import com.gzhryc.common.json.JsonTools;
import com.gzhryc.net_marketing.api.protocol.account.CloudPayNotifyRequest;
import com.gzhryc.net_marketing.cloud.MarketConstants;
import com.gzhryc.net_marketing.cloud.account.HttpCallbackDelayEvent;
import org.apache.http.HttpResponse;

public class CloudPayNotifyCallbackDelayEvent extends HttpCallbackDelayEvent {

    private static final long serialVersionUID = 1L;
    
	private String url;
    private CloudPayNotifyRequest request;
    private String content;

    public CloudPayNotifyCallbackDelayEvent(){}

    public CloudPayNotifyCallbackDelayEvent(String url, CloudPayNotifyRequest request){
        this.url = url;
        this.request = request;
    }

    @Override
    public String getUrl() {
        return url;
    }

    @Override
    public String getStringEntity() {
        if(StringTools.isBlank(content) && request != null){
            this.content = JsonTools.toJson(request);
        }
        return this.content;
    }

    @Override
    public void sendSuccess(HttpResponse result) {

    }

    @Override
    public void sendFail() {

    }

    @Override
    public String getJdbcKey() {
        return MarketConstants.JDBC_KEY;
    }
}
